#include "Scene.hpp"

void Scene::_init()
{
    if (!inited)
    {
        init();
        inited = true;
    }
}

Scene::Scene(int width, int height)
{
    this->width = width;
    this->height = height;
}

void Scene::init()
{
}

int Scene::update(real delta)
{
    return 0;
}

void Scene::render(SDL_Renderer *render)
{
    SDL_Color color = {0xff, 0xff, 0xff, 0};
    const Uint16 *text = (Uint16 *)L"这是默认场景";
    SDL_Surface *text_sur = TTF_RenderUNICODE_Blended(Static::default_font, text, color);
    SDL_Texture *text_tex = SDL_CreateTextureFromSurface(render, text_sur);
    SDL_Rect rc = {0};
    TTF_SizeUNICODE(Static::default_font, text, &rc.w, &rc.h);
    rc.x = (width - rc.w) / 2;
    rc.y = (height - rc.h) / 2;
    SDL_RenderCopy(render, text_tex, nullptr, &rc);
    SDL_DestroyTexture(text_tex);
    SDL_FreeSurface(text_sur);
}

int Scene::handleEvent(SDL_Event &evt)
{
    return 0;
}

std::list<std::string> Scene::getViewableData()
{
    return viewable_list;
}
